<template>
	<view>
		<view v-if="is_show" >

 
			<view class="zabj">
				<view @click="on_url('../../pages/banmi/user_set',1)" class="flex j-f pt2"
					style="padding-right: 60rpx;">
					<image style="width: 50rpx;height: 50rpx;" src="../../static/tab/shezhi.png"></image>
				</view>
				<view @click="on_url('../../pages/banmi/user_set',1)" class=" flex a-c"
					style="padding-top: 10rpx;padding-right: 60rpx;padding-left: 60rpx;">
					<view class="">
						<image class="q_y" :src="user.face|getFace"
							style="width: 130rpx;height: 130rpx;border:3px solid #fff;">
						</image>

					</view>
					<view class="ml20" style="margin-top: -10rpx;">
						<text class="w800" style="font-size: 40rpx;color: #fff;">{{user.nickname}}</text>
						<view class="cff pt1">
							<text>Uid:{{user.uid}}</text>
						</view>
					</view>
				</view>
			</view>
			<view class="p2">
				<view class="p20 b_y" style="margin-top: -200rpx;background-color: #fff;">
					<view @click="on_url('../../pages/banmitongcheng/my_shop_collection',1)" class="p20"
						style="background-color: #fff;padding-top: 40rpx;padding-bottom: 40rpx;">
						<view class="flex j-b a-c">
							<view class="flex a-c">

								<text class="ml1 f30">我的收藏</text>
							</view>
							<view class="">
								<image style="width: 30rpx;height: 30rpx;" src="../../static/tab/you.png"></image>
							</view>
						</view>
					</view>
					<view @click="on_url('../../pages/banmitongcheng/my_shop',1)" class="p20"
						style="padding-top: 40rpx;padding-bottom: 40rpx;">
						<view class="flex j-b a-c">
							<view class="flex a-c">

								<text class="ml1 f30">我的电话</text>
							</view>
							<view class="">
								<image style="width: 30rpx;height: 30rpx;" src="../../static/tab/you.png"></image>
							</view>
						</view>
					</view>

				</view>
			</view>

		</view>
		<tabbar></tabbar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: {
					face: '',
					nickname: '！请登录',
					uid: '0000000'
				},
				token: '',
				is_show: false
			}
		},
		onLoad() {
			var that = this;
			this.token = uni.getStorageSync('token');
			if (this.token) {
				this.init();
			} else {
				this.is_show = true
			}
			uni.$on('banmi_login', function(data) {
				that.token = uni.getStorageSync('token');
				that.init();
			})
			uni.$on('banmi_nickname', function(data) {
				that.user.nickname = data.title
			})
			uni.$on('banmi_face', function(data) {
				that.user.face = data.title
			})
		},
		methods: {
			init() {
	 
				var that = this;
				this.Banmikeji.user_info().then(ret => {
					if (ret != 0) {
						that.user = ret.data.user;
					 
					} else {
						that.token = uni.getStorageSync('token');
						that.user_id = uni.getStorageSync('user_id');
					}
					that.is_show = true
				})
			},
			article_view(index) {

				uni.navigateTo({
					url: '/pages/banmi/article_view?id=' + index
				})
			},
			on_url(url, index) {

				if (index == 1) {
					if (!uni.getStorageSync('token')) {
						uni.navigateTo({
							url: '/pages/banmi/user_login'
						})
						return
					}
				}
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style>
	.zabj {
		background-size: 100% 100%;
		-moz-background-size: 100% 100%;
		height: 450rpx;
		background-repeat: no-repeat;

		background-color: #4510A6;
		border-bottom-left-radius: 50rpx;
		border-bottom-right-radius: 50rpx;


	}
</style>